package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
//model layer package has to be imported

/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 */
public class AddressCtr
{
    
    //declare instance variables to reference containers
    private Addressbook addressbook;
    
    
    public AddressCtr()
    {
        addressbook = Addressbook.getInstance();
    }
    
    //Creates a new Person and adds it to the addressbook collection
    public void createPerson(long id, String name, String address, String postalCode, String city, String phoneNr)
    {   
       //creates a Person object and stores it in the container
       Person newPerson = new Person(id, name, address, postalCode, city, phoneNr);
       addressbook.addPerson(newPerson);
       System.out.println("Person has been created!");
    }
    
    public void getPerson(long id)
    {
        addressbook.getPerson(id);
    }
    
    public void deletePerson(long id)
    {
        addressbook.deletePerson(id);
    }
    
    public void updatePerson(long id, String name, String address, String postalCode,
    String city, String phoneNr)
    {
        addressbook.updatePerson(id, name, address, postalCode, city, phoneNr);
    }
    
    public void listAllPersons()
    {
          addressbook.listPersons();
    }
}